<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 你有一个 user 对象数组，每个对象都有 user.name。编写将其转换为 names 数组的代码。
        let users = [
            { name: "John", age: 25 },
            { name: "Pete", age: 30 },
            { name: "Mary", age: 28 }
        ]
        let newArr = users.map(function(obj){
            return obj.name;
        })
        console.log(newArr);
    </script>
</body>

</html>